package com.link2room.rodimus.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * Created by sss on 2017/8/7.
 */
@Entity
@Table(name = "point_rule")
@DynamicInsert
public class PointRule extends BaseEntity{
    private String pointRuleCode;
    private String pointRuleName;
    private Date startDate;
    private Date endDate;
    private String pointRuleDetail;
    private String pointUseDates;
    private String taCode;
    private String isUseDates;

    @Basic
    @Column(name = "point_rule_code", nullable = false, length = 32)
    public String getPointRuleCode() {
        return pointRuleCode;
    }

    public void setPointRuleCode(String pointRuleCode) {
        this.pointRuleCode = pointRuleCode;
    }

    @Basic
    @Column(name = "point_rule_name", nullable = false, length = 32)
    public String getPointRuleName() {
        return pointRuleName;
    }

    public void setPointRuleName(String pointRuleName) {
        this.pointRuleName = pointRuleName;
    }

    @Basic
    @Column(name = "start_date", nullable = true)
    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    @Basic
    @Column(name = "end_date", nullable = true)
    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    @Basic
    @Column(name = "point_rule_detail", nullable = true, length = -1)
    public String getPointRuleDetail() {
        return pointRuleDetail;
    }

    public void setPointRuleDetail(String pointRuleDetail) {
        this.pointRuleDetail = pointRuleDetail;
    }

    @Basic
    @Column(name = "point_use_dates", nullable = true, length = -1)
    public String getPointUseDates() {
        return pointUseDates;
    }

    public void setPointUseDates(String pointUseDates) {
        this.pointUseDates = pointUseDates;
    }

    @Basic
    @Column(name = "ta_code", nullable = true, length = 16)
    public String getTaCode() {
        return taCode;
    }

    public void setTaCode(String taCode) {
        this.taCode = taCode;
    }

    @Basic
    @Column(name = "is_use_dates", nullable = true, length = 2)
    public String getIsUseDates() {
        return isUseDates;
    }

    public void setIsUseDates(String isUseDates) {
        this.isUseDates = isUseDates;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PointRule pointRule = (PointRule) o;

        if (pointRuleCode != null ? !pointRuleCode.equals(pointRule.pointRuleCode) : pointRule.pointRuleCode != null)
            return false;
        if (pointRuleName != null ? !pointRuleName.equals(pointRule.pointRuleName) : pointRule.pointRuleName != null)
            return false;
        if (startDate != null ? !startDate.equals(pointRule.startDate) : pointRule.startDate != null) return false;
        if (endDate != null ? !endDate.equals(pointRule.endDate) : pointRule.endDate != null) return false;
        if (pointRuleDetail != null ? !pointRuleDetail.equals(pointRule.pointRuleDetail) : pointRule.pointRuleDetail != null)
            return false;
        if (pointUseDates != null ? !pointUseDates.equals(pointRule.pointUseDates) : pointRule.pointUseDates != null)
            return false;
        if (taCode != null ? !taCode.equals(pointRule.taCode) : pointRule.taCode != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = pointRuleCode != null ? pointRuleCode.hashCode() : 0;
        result = 31 * result + (pointRuleName != null ? pointRuleName.hashCode() : 0);
        result = 31 * result + (startDate != null ? startDate.hashCode() : 0);
        result = 31 * result + (endDate != null ? endDate.hashCode() : 0);
        result = 31 * result + (pointRuleDetail != null ? pointRuleDetail.hashCode() : 0);
        result = 31 * result + (pointUseDates != null ? pointUseDates.hashCode() : 0);
        result = 31 * result + (taCode != null ? taCode.hashCode() : 0);
        return result;
    }
}
